package org.itark.bbs.common.exception;

import lombok.Getter;
import lombok.Setter;
import org.itark.bbs.common.constants.enums.IErrors;

/**
 * @author ：lishenglei
 * @date ：Created in 2021/6/30 18:06
 * @description：
 */
@Setter
@Getter
public class ApplicationException extends RuntimeException {

    private int code;
    private String msg;
    private Object data;

    public ApplicationException(int code, String msg, Object data) {
        super(msg);
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ApplicationException(IErrors errors) {
        super(errors.getMessage());
        this.code = errors.getCode();
        this.msg = errors.getMessage();
    }

}
